package com.sinya.shoppingmall.fragment;

import android.os.Handler;
import android.os.Message;
import android.view.View;

import com.sinya.shoppingmall.R;
import com.sinya.shoppingmall.enums.SortType;
import com.sinya.shoppingmall.https.VolleyParams;
import com.sinya.shoppingmall.https.VolleyRequest;

/**
 * 搜索结果页面
 *
 * @author KoizumiSinya
 * @date 2016/1/12.
 */
public class SearchResultFragment extends BaseFragment {

    // [+] Handler

    Handler handler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) {
            switch (msg.what) {
                case 0:

                    break;
                default:
                    break;
            }

            return false;
        }
    });

    // [-] Handler
    // [+] Override Mothd

    @Override
    protected View initView() {
        return View.inflate(mContext, R.layout.view_search_result, null);
    }

    @Override
    protected void setView() {

    }

    @Override
    protected void setTitle() {

    }

    // [-] Override Mothd

    public static SearchResultFragment getInstanse() {
        SearchResultFragment fragment = new SearchResultFragment();
        return fragment;
    }

    /**
     * 执行搜索请求
     *
     * @param key
     */
    public void executeSearch(String key) {
        VolleyRequest.Start(mContext, handler, 0, VolleyParams.search, key, "1", "10", SortType.SALEDOWN.getType());
    }
}
